package com.shop2cn.iapi.sqrefund.testcase;

import java.math.BigDecimal;
import java.util.Arrays;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.sqrefund.parameter.SaveOrUpdateMerchantRefundConfigReq;
import com.shop2cn.iapi.sqrefund.service.SaveOrUpdateMerchantRefundConfigCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.TestDataManager;

/**
 * 发货 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_SaveOrUpdateMerchantRefundConfig {

	private static SaveOrUpdateMerchantRefundConfigReq saveOrUpdateMerchantRefundConfigReq;
	private static SaveOrUpdateMerchantRefundConfigCall saveOrUpdateMerchantRefundConfigCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("保存或者更新商家退货配置");
	}

	@Before
	public void caseUp() {

		saveOrUpdateMerchantRefundConfigReq = new SaveOrUpdateMerchantRefundConfigReq();
		saveOrUpdateMerchantRefundConfigCall = new SaveOrUpdateMerchantRefundConfigCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(saveOrUpdateMerchantRefundConfigCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_SaveOrUpdateMerchantRefundConfig_001() {
		Logger.start(false, "保存或者更新商家退货配置成功");
		try {
			
			saveOrUpdateMerchantRefundConfigReq.setMerchantId((long)TestDataManager.getRandomIntNum(8));
			saveOrUpdateMerchantRefundConfigReq.setUserId(TestDataManager.getRandomIntNum(8));
			saveOrUpdateMerchantRefundConfigReq.setUsername(TestDataManager.randomStr(10));
			saveOrUpdateMerchantRefundConfigReq.setAutoAcceptOrder(true);
			saveOrUpdateMerchantRefundConfigReq.setAcceptOrderDelay(10);
			saveOrUpdateMerchantRefundConfigReq.setSuperReview(true);
			saveOrUpdateMerchantRefundConfigReq.setSuperReviewThresholdAmount(BigDecimal.TEN);
			saveOrUpdateMerchantRefundConfigReq.setSuperReviewRoles(Arrays.asList(10L, 2092L, 3891L));

			saveOrUpdateMerchantRefundConfigCall.setData(saveOrUpdateMerchantRefundConfigReq);
			saveOrUpdateMerchantRefundConfigCall.callService();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
